package cn.rumoss.innerclass;

/**
 * @ClassName AnonymousTest
 * @Description //TODO
 * @Author HeCG
 * @Date 19-3-7 上午9:19
 */
public class AnonymousTest {
    public static void main(String args[])
    {
        new AnonymousTest().play();
    }

    private void play()
    {
        Dog dog = new Dog();
        Runnable runnable = new Runnable()
        {
            public void run()
            {
                while(dog.getAge()<100)
                {
                    // 过生日，年龄加一
                    dog.happyBirthday();
                    // 打印年龄
                    System.out.println(dog.getAge());
                }
            }
        };
        new Thread(runnable).start();

        // do other thing below when dog's age is increasing
        // ....
    }
}
